<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="./vue.min.js"></script>
</head>

<body>
  <div id="app">
    {{value}}
    <my_child ref="childRef" :value1s.sync="value" @click.native="childChild" />
  </div>

  <script>
    var child = {
      props: ['value'],
      data() {
        return{age: 12}
      },
      template: `
     <div >
      {{age}}
       <input @input="inputChange" v-foure :value="value" />
     </div>
     `,
      methods: {
        inputChange($event) {
          this.$emit('update:value1s', $el.target.value)
        }
      },
      directives:{
        foure:{
          inserted(el){
            el.focus()
          }
        }
      },
      mounted(){
      }
    }
    var vm = new Vue({
      el: '#app',
      data: {
        value: 0
      },
      methods: {
        childChild(e){
          console.log(e)
        }
      },
      components: {
        'my_child': child
      },
      mounted() {
      },
    });
  </script>
</body>

</html>